//
//  ProtectGuideView.swift
//  MyTest
//
//  Created by guanzhongwang on 2021/5/13.
//

import UIKit
class ProtectGuideView: UIView {
    class func show(){
        _ = ProtectGuideView()
    }
    private init() {
        super.init(frame: UIScreen.main.bounds)
        backgroundColor = UIColor.init(red: 0, green: 0, blue: 0, alpha: 0.7)
        UIApplication.shared.delegate?.window??.addSubview(self)
        let view  = UIView()
        view.backgroundColor = .white
        view.layer.cornerRadius = 5
        view.clipsToBounds = true
        addSubview(view)
        view.snp.makeConstraints({
            $0.center.equalToSuperview()
            $0.height.width.equalTo(snp.width).multipliedBy(0.7)
        })
        
        let name = UILabel()
        view.addSubview(name)
        name.text = "个人信息保护指引"
        name.textColor = B000_COLOR
        name.snp.makeConstraints({
            $0.centerX.equalToSuperview()
            $0.top.equalTo(30)
        })
        
        let okbtn = UIButton(type: .custom)
        view.addSubview(okbtn)
        okbtn.setTitle("我知道了", for: .normal)
        okbtn.setTitleColor(.white, for: .normal)
        okbtn.backgroundColor = RED_COLOR
        okbtn.snp.makeConstraints({
            $0.left.right.bottom.equalTo(0)
            $0.height.equalTo(40)
        })
        okbtn.addTarget(self, action: #selector(dismiss), for: .touchUpInside)
    }
    @objc func dismiss(){
        self.removeFromSuperview()
    }
    required init?(coder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
}
